/**
 * 2013-6-26 上午12:20:59 Created By niexiaoqiang
 */

package com.xiaoqiang.MtwV2ForMoblie.listener;

import com.xiaoqiang.MtwV2ForMoblie.MainActivity;
import com.xiaoqiang.util.download.DownLoadObjectInfo;
import com.xiaoqiang.util.download.event.DownLoadSizeChangedEvent;
import com.xiaoqiang.util.download.listener.DownLoadSizeChangedListener;

/**
 * 配置文件下载完成监听器，通知主界面更新配置文件已完成
 */
public class MainActivityConfigFileDownLoadSizeChangedListener implements DownLoadSizeChangedListener {
	private MainActivity mainActivity;

	public MainActivityConfigFileDownLoadSizeChangedListener(MainActivity mainActivity) {
		this.mainActivity = mainActivity;
	}

	@Override
	public void downLoadSizeChanged(DownLoadSizeChangedEvent event) {
		DownLoadObjectInfo downLoadObjectInfo = event.getDownLoadObjectInfo();
		if ("mtwInfo.properties".equals(downLoadObjectInfo.getFilename())) {
			if (downLoadObjectInfo.getDownloadsize() == downLoadObjectInfo.getFilesize()) {
				mainActivity.getServerConfigisend = true;
			}
		}
	}
}
